<script setup lang="ts">
import { useMemberStore } from '@/stores/modules/member'
const menberStore = useMemberStore()
//退出登录
const onLogout = () => {
  //弹窗
  uni.showModal({
    content: '是否退出登录？',
    success: (res) => {
      if (res.confirm) {
        //为真，清理用户信息
        menberStore.clearProfile()
        //返回上一页
        uni.navigateBack()

      }
    },
  })
}

</script>

<template>
  <view class="viewport">
    <!-- 列表1 -->
    <view class="list" v-if="menberStore.profile">
      <navigator url="" hover-class="none" class="item arrow">
        账号与安全
      </navigator>
      <navigator url="" hover-class="none" class="item arrow">
        隐私设置
      </navigator>
    </view>
    <!-- 列表2 -->
    <view class="list">
      <button hover-class="none" class="item arrow" open-type="openSetting">通知设置</button>
      <button hover-class="none" class="item arrow" open-type="feedback">通用设置</button>
      <button hover-class="none" class="item arrow" open-type="contact">编辑资料</button>
      <button hover-class="none" class="item arrow" open-type="contact">推送设置</button>
      <button hover-class="none" class="item arrow" open-type="contact">清除缓存</button>
    </view>
    <!-- 列表3 -->
    <view class="list">
      <navigator hover-class="none" class="item arrow" url=" ">帮助与客服</navigator>
      <navigator hover-class="none" class="item arrow" url=" ">打分反馈</navigator>
    </view>
    <!-- 操作按钮 -->
    <view class="action" v-if="menberStore.profile">
      <view class="button" @tap="onLogout">退出登录</view>
    </view>
  </view>
</template>

<style lang="scss">
page {
  background-color: #f4f4f4;
}

.viewport {
  padding: 30rpx;
}

/* 列表 */
.list {
  padding: 0 30rpx;
  background-color: #fff;
  margin-bottom: 20rpx;
  border-radius: 30rpx;

  .item {
    line-height: 90rpx;
    padding-left: 10rpx;
    font-size: 30rpx;
    color: #333;
    border-top: 1rpx solid #ddd;
    position: relative;
    text-align: left;
    border-radius: 0;
    background-color: #fff;

    &::after {
      width: auto;
      height: auto;
      left: auto;
      border: none;
    }

    &:first-child {
      border: none;
    }

    &::after {
      right: 5rpx;
    }
  }

  .arrow::after {
    content: '\e6c2';
    position: absolute;
    top: 50%;
    color: #ccc;
    font-family: 'erabbit' !important;
    font-size: 32rpx;
    transform: translateY(-50%);
  }
}

/* 操作按钮 */
.action {
  text-align: center;
  line-height: 90rpx;
  margin-top: 40rpx;
  font-size: 32rpx;
  color: #333;

  .button {
    background-color: #fff;
    margin-bottom: 10rpx;
    border-radius: 5rpx;
    color: #FF5733;
    border-radius: 30rpx;
  }
}
</style>
